import request from '@/common/request.js'


import eg from './modules/eg.js'
// import md5 from '@/utils/md5.js'
import home from './modules/home'
import login from './modules/login'
import mine from "./modules/mine.js"

/**
 * object转化成url拼接样式
 * @param obj 需要转化的参数
 */
const objToUrl = obj => {
	let arr = [];
	for (let i in obj) {
		if (obj.hasOwnProperty(i)) {
			arr.push(encodeURIComponent(i) + "=" + encodeURIComponent(obj[i]));
		}
	}
	return arr.join("&");
}
/**
 * url转化成object拼接样式
 * @param url 需要转化的参数
 */
const urlToObj = url => {
	let string = url.split('&');
	let res = {};
	for (let i = 0; i < string.length; i++) {
		let str = string[i].split('=');
		if (str[0] != '') {
			res[str[0]] = str[1];
		}
	}
	return res;
}


const API = {
	// xxxUrl:"xxx", // 其他公用参数
	// -------------------引入分割的模块---------------------
	...home,
	...login,
	...mine,
	...eg,
	// -------------------引入分割的模块结束---------------------

}

export default API